<template>
  <div class="login-page">
    <h1>登录页面</h1>
    <el-button type="primary" @click="addToken">添加token完成登录</el-button>
  </div>
</template>

<script setup>
import { ref, reactive, computed, watch, onMounted, onUnmounted } from "vue";
import {$localStorage} from "@/utils/utils"
//引入路由
import router from "@/router";

// 添加token完成登录
const addToken = () => {
  const token = "xxxxxx"; // 假设获取到的token
  $localStorage.setItem("token", token); // 保存token到localStorage
  window.location.href = "/"; // 跳转到首页
  
  // router.push("/"); // 跳转到首页
  //

};


onMounted(() => {});
onUnmounted(() => {});
</script>

<style lang="scss" scoped>
.login-page {
  text-align: center;
}
</style>
